package lekcja2.zad6.prostszy;

import java.util.Random;

public class Zad6 {
    public static void main(String[] args) {
        final int TAB_SIZE = 10;

        double[] tab1 = new double[TAB_SIZE];
        double[] tab2 = new double[TAB_SIZE];
        Random random = new Random();
        for (int i = 0; i < TAB_SIZE; i++) {
            tab1[i] = random.nextDouble() * 10;
            tab2[i] = random.nextDouble() * 10;
        }

        double[] tab3 = new double[TAB_SIZE + TAB_SIZE];

        // Pierwszy sposób kopiowania tablic
        /* for(int i =0; i<TAB_SIZE; i++){
            tab3[i] = tab1[i];
        }

        for(int i = 0; i<TAB_SIZE; i++){
           tab3[i+10] = tab2[i];
        }*/

        // drugi sposób kopiowania tablic
        System.arraycopy(tab1, 0, tab3, 0, 10);
        System.arraycopy(tab2, 0, tab3, 10, 10);

        for (int i = 0; i < tab3.length; i++) {
            System.out.println(tab3[i]);
        }
    }
}
